home *** CD-ROM | disk | FTP | other *** search
- /***********************************************************************
- *
- * AccessPriv uglobals.c
- *
- * Copyright (c)
- * Apple Computer, Inc. 1989-1990
- * All Rights Reserved.
- *
- * Developer Technical Support Apple II Sample Code
- *
- * This file contains the global variables used by the program.
- *
- ***********************************************************************/
-
- #include "ap.h"
-
- #include <quickdraw.h>
- #include <window.h>
- #include <control.h>
- #include <types.h>
- #include <stdfile.h>
- #include <GSOS.h>
- #include <AppleShare.h>
-
- unsigned int suppressErrors; /* Used so user can cancel SFMultiGet2 */
- unsigned int userID; /* returned from MMStartUp */
- unsigned int quitFlag = 0; /* True when quitting */
- unsigned int staggerCount = 0; /* Used to stagger windows as they open */
- WmTaskRec event; /* All events are returned here */
-
- GrafPortPtr windowList[NumWindows];
- handle PrivCtrlHndls[7][3];
- ptr mysubsttext[9];
- GetAccessRightsRec curaccessprivs;
- SetAccessRightsRec newaccessprivs;
-
- GSString32Ptr DirEntryNamePtr;
- ResultBuf32 DirEntryResultBuf;
- DirEntryRecGS myGetDirEntryRec;
-
- UserInfoRec ASuserinfoRec;
-
- GetPrivilegesRec ASgetprivsRec;
- SetPrivilegesRec ASsetprivsRec;
- ResultBuf255 ownernametoget, ownernametoset;
- ResultBuf255 groupnametoget, groupnametoset;
- ResultBuf255 usernametoget, usergroupnametoget, SFpathresult;
- GSString255 foldertogetsetprivsof, volname;
-
- GSString255Ptr pathstrPtr;
-
- char hastheseprivs[60],blanks[255];
-
- byte power2[3];
- unsigned int userisowner;
-
-
- multiReplyRecord myReply;
-
-
- extern int _toolErr;
-
-
- void initAShareFSTSpecificPBs()
- {
- ASgetprivsRec.pCount = 6;
- ASgetprivsRec.fstNum = appleShareFSID;
- ASgetprivsRec.commandNum = ASGetPrivileges;
- ASgetprivsRec.pathname = &foldertogetsetprivsof;
- ASgetprivsRec.ownerName = &ownernametoget;
- ownernametoget.bufSize = 259;
- ASgetprivsRec.groupName = &groupnametoget;
- groupnametoget.bufSize = 259;
-
- ASsetprivsRec.pCount = 6;
- ASsetprivsRec.fstNum = appleShareFSID;
- ASsetprivsRec.commandNum = ASSetPrivileges;
- ASsetprivsRec.pathname = &foldertogetsetprivsof;
- ASsetprivsRec.ownerName = &ownernametoset;
- ownernametoset.bufSize = 259;
- ASsetprivsRec.groupName = &groupnametoset;
- groupnametoset.bufSize = 259;
-
- ASuserinfoRec.pCount = 5;
- ASuserinfoRec.fstNum = appleShareFSID;
- ASuserinfoRec.commandNum = ASUserInfo;
- ASuserinfoRec.userName = &usernametoget;
- usernametoget.bufSize = 259;
- ASuserinfoRec.primaryGroupName = &usergroupnametoget;
- usergroupnametoget.bufSize = 259;
-
- myGetDirEntryRec.pCount = 14;
- myGetDirEntryRec.name = (ResultBuf255Ptr) &DirEntryResultBuf;
- DirEntryResultBuf.bufSize = 32;
- DirEntryNamePtr = &DirEntryResultBuf.bufString;
-
- SFpathresult.bufSize = 259;
- }
-
- void initGlobals()
- {
- int i;
-
- for (i = 0; i < 255; i++) blanks[i] = ' '; /* blank out string */
- blanks[255] = (char) 0;
- (ownernametoget.bufString).text[0] = (char) 0; /* make strings null */
- (groupnametoget.bufString).text[0] = (char) 0;
- mysubsttext[1] = &(volname.text[1]); /* init static text */
- mysubsttext[2] = (usernametoget.bufString).text; /* subst. ptrs */
- mysubsttext[3] = &(hastheseprivs[0]);
- mysubsttext[4] = (ownernametoget.bufString).text;
- mysubsttext[5] = (groupnametoget.bufString).text;
-
- DirEntryNamePtr->text[0] = (char) 0;
- /* init ptr to Standard File str */
- pathstrPtr = (GSString255Ptr) &(SFpathresult.bufString);
-
- power2[0] = 1; /* powers of 2 used to select bits 0-2 */
- power2[1] = 2;
- power2[2] = 4;
- curaccessprivs = (GetAccessRightsRec) 0L;
- initAShareFSTSpecificPBs();
- userisowner = FALSE;
- quitFlag = staggerCount = suppressErrors = 0;
- }
-